package main

import (
	"algorithms/lib"
	"fmt"
	"github.com/davecgh/go-spew/spew"
)

var (
	Labels = []string{
		"递归",
		"回溯",
		"动态规划",
		"贪心",
		"快慢指针",
		"虚拟头指针",
		"双指针滑动",
		"滑动窗口",
		"数学",
		"大整数",
		"位数操作",
		"矩阵",
		"字符串",
		"排序",
		"二分查找",
		"奇偶性",
		"哈希表",
		"去重",
		"空间复用",
		"链表",
		"大小堆",
		"栈",
		"二叉树",
		"二叉搜索树",
		"层序遍历",
		"有限状态机",
	}
)

var (
	Specials=[]int{
		84,
		85,
		109,
		114,
	}
)

func GetAllLabels() map[string]bool {
	labels := make(map[string]bool, 0)
	for _, prob := range lib.Probs {
		for label := range prob.Labels {
			_, exist := labels[label]
			if !exist {
				labels[label] = true
			}
		}
	}

	spew.Dump(labels)
	return labels
}

func main() {
	labels := []string{
		"拓扑排序",
	}

	//GetAllLabels()

	res := make([]lib.Problem, 0)
	for _, prob := range lib.Probs {
		match := true
		for _, label := range labels {
			_, exist := prob.Labels[label]
			if !exist {
				match = false
				break
			}
		}

		if match {
			res = append(res, prob)
		}
	}

	spew.Dump(res)
	fmt.Println("\nfound: ", len(res))
}
